<template>
  <div class="app">
<!--    to：放到哪个选择器-->
    <teleport to="#wmy">
      <h2>当前计数</h2>
      <button @click="foo">+1</button>
    </teleport>
  </div>
</template>

<script>
import {getCurrentInstance} from "vue";

export default {
  //如果要用setup拿
  setup(){
    const instance = getCurrentInstance();
    console.log(instance.appContext.config.globalProperties.$name);
  },

  methods: {
    foo(){
      console.log(this.$name);
    }
  }
}
</script>

<style scoped>

</style>